
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

test1=webdriver.Chrome()

test1.get('https://www.baidu.com/')
sleep(3)
a=test1.find_element(By.XPATH,"//input[@id='kw']")
a.send_keys("jiangzemin")
sleep(3)
# test1.find_element("id","kw").send_keys("软件测试")
# sleep(3)
# add1=test1.find_element(By.ID,"kw")
# add1.send_keys("软件测试")
# sleep(3)
add2=test1.find_element(By.ID,"su")
add2.click()
sleep(4)

# add1=test1.find_element(By.LINK_TEXT,"使用百度前必读")
# add1.click()
# sleep(3)
# print(test1.title)
# print(test1.current_url)

test1.refresh()












# # 导包
# from time import sleep
# from selenium import webdriver
#
# # 实例化浏览器
# driver = webdriver.Chrome()
#
# # 打开网址
# driver.get('https://www.baidu.com/')
#
# # 需求
# ele = driver.find_element_by_css_selector('#kw')
# ele.send_keys('火锅')
# sleep(2)
#
# # 清空
# ele.clear()
# ele.send_keys('串串')
#
# # 时间轴看效果
# sleep(3)
#
# # 关闭页面
# driver.quit()
